export default {
  state() {
    return {
      num: 10,
      name: '亚瑟'
    }
  },
  mutations: {
    adda(state, n = 1) {
      state.num += n
    },
    suba(state, n = 1) {
      state.num -= n
    }
  },
  actions: {
    asyncsuba(context, n) {
      setTimeout(() => {
        context.commit('suba', n)
      }, 1000)
    },
    asyncadda(context, n) {
      setTimeout(() => {
        context.commit('adda', n)
      }, 1000)
    }
  },
  getters: {
    change: state => {
      return `美化后的${state.name}`
    }
  }
}
